<%= section_panel 'Public Designs', :width => 'single' do %>
  <%= ci_list(@public_designs,
              :toolbar => {:list_name => 'catalog_public_designs',
                           :sort_by   => [%w(Name ciName), %w(Created created)],
                           :filter_by => %w(ciName ciId)}) do |builder, target| %>
    <% builder.target link_to('', catalog_design_path(target), :remote => false) %>
    <% builder.icon :none %>
    <% if is_admin? %>
      <% builder.menu do %>
        <%= link_to(icon('plus', 'New Assembly'), new_assembly_path(:catalog_template => target.ciId)) %>
      <% end %>
    <% end %>
  <% end %>
<% end %>

<%= section_panel 'Private Designs', :width => 'single' do %>
  <%= ci_list(@private_designs,
              :toolbar => {:list_name => 'catalog_public_designs',
                           :sort_by   => [%w(Name ciName), %w(Created created)],
                           :filter_by => %w(ciName ciId)}) do |builder, target| %>
    <% builder.target link_to('', catalog_design_path(target), :remote => false) %>
    <% builder.icon :none %>
    <% builder.menu do %>
      <%= link_to(icon('plus',     'New Assembly'), new_assembly_path(:catalog_template => target.ciId)) if is_admin? %>
      <%= link_to(icon('download', 'Export'), export_catalog_design_path(target)) %>
      <%= link_to(icon('trash',    'Delete'), catalog_design_path(target), :method => :delete, :remote => true, :confirm => "Delete catalog '#{target.ciName}'?") %>
    <% end %>
  <% end %>
<% end %>

<%= section_panel 'Import Design', :width => 'single', :position => 'right' do %>
  <%= form_tag import_catalog_designs_path, :multipart => true do %>
    <div class="control-group">
      <%= label_tag :name, 'Name', :class => 'control-label' %>
      <div class="controls">
        <%= text_field_tag :name, '', :pattern => Cms::Ci.valid_ci_name_regexp('catalog.Platform') %>
      </div>
    </div>
    <div class="control-group">
      <%= label_tag :description, 'Description', :class => 'control-label' %>
      <div class="controls">
        <%= text_area_tag :description, '', :rows => 3 %>
      </div>
    </div>
    <div class="control-group">
      <div class="controls">
        <%= render 'base/shared/input_file', :field_name => :data, :prompt => 'Choose design file...' %>
      </div>
    </div>
    <div class="form-actions">
      <%= button_tag(icon('upload', 'Import'), :class => 'btn btn-success', :data => {:disable_with => '<i class="fa fa-upload"></i> Loading...'}) %>
    </div>
  <% end %>
<% end %>
